//
//  DXRetweetedView.swift
//  weiBoOfSwift
//
//  Created by simon on 15/12/10.
//  Copyright © 2015年 simon. All rights reserved.
//

import UIKit

class DXRetweetedView: UIView {
    
    var statuesViewModel:DXStatuesViewModel?{
        
        didSet{
//           
            retweetedTextLabel.attributedText = statuesViewModel!.retweetedStatuesAttribute
            retweetedTextLabel.statuesLinks = statuesViewModel!.retweetedStatuesLinks
            
            pictureView.pictures = statuesViewModel?.statuesMoel?.retweeted_status?.pic_urls

        }
    }
    


    
    override init(frame: CGRect) {
        super.init(frame: frame)
        backgroundColor = UIColor.init(white: 0.95, alpha: 1)
            setUpUI()
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
//  初始化UI
    private func setUpUI(){
        addSubview(retweetedTextLabel)
//        配图
        addSubview(pictureView)
//        添加约束
        retweetedTextLabel.snp_makeConstraints { (make) -> Void in
            make.top.equalTo(self).offset(KStatuesCellMargin)
            make.leading.equalTo(self).offset(KStatuesCellMargin)
            make.trailing.equalTo(self).offset(-KStatuesCellMargin)
        }
//        配图约束
        pictureView.snp_makeConstraints { (make) -> Void in
            make.top.equalTo(retweetedTextLabel.snp_bottom).offset(KStatuesCellMargin)
            make.leading.equalTo(retweetedTextLabel)
            
//            make.size.equalTo(CGSizeMake(200, 200))
        }
        
        self.snp_makeConstraints { (make) -> Void in
            make.bottom.equalTo(pictureView).offset(KStatuesCellMargin)
        }
        
        
    }
//    懒加载
  
    lazy var retweetedTextLabel:DXStatuesLabel = DXStatuesLabel(textColor: nil, fonSize: kstatuesFontSize)
    lazy var pictureView:DXPictureView = DXPictureView()
}
